import haven.javafx.module.base.BaseController;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Popup;
import javafx.stage.Stage;

public class MainController extends BaseController {

@FXML
Button btn1;
@FXML
    Text text1;
Stage stage;
Scene scened;
    @Override
    public void init() {

    }

    @Override
    public void bindEvent() {
        btn1.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                Integer clickCount = event.getClickCount();
                text1.setText(clickCount.toString());
                stage.setTitle(clickCount.toString());
                scened.setCursor(Cursor.MOVE);
                scened.getWindow().setHeight(600);
                scened.getWindow().setWidth(600);
                Popup popup = new Popup();
                Button button = new Button();
                Label text = new Label();
                text.setText("hello i am popup");

                popup.getContent().addAll(text);
                popup.show(stage);
                popup.setX(stage.getX()+10);
                popup.setY(stage.getY()+stage.getHeight()-text.getHeight()-10);
                popup.setAutoHide(true);
                btn1.setTextFill(Color.color(clickCount,clickCount,0));
            }
        });
    }
}
